package com.bw.zhuangao5___day002.Fragment.Music;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bw.zhuangao5___day002.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * create by ertu
 * create on 2021/9/24
 * description
 */
public class MuiscBaseAdpter extends BaseQuickAdapter<JavaMuisc.DataBean, BaseViewHolder> {

    public MuiscBaseAdpter( @Nullable List<JavaMuisc.DataBean> data) {
        super(R.layout.muiscfragment1xml, data);

    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, JavaMuisc.DataBean dataBean) {
        Glide.with(getContext()).load(R.drawable.guanguan)
//                .placeholder(R.mipmap.kotlin2)//还没有发起网络请求,一般空白或者公司logo
//                .error(R.mipmap.chentu)//发起请求失败，一般撕裂
                .diskCacheStrategy(DiskCacheStrategy.NONE)//关闭磁盘
                .skipMemoryCache(true)//关闭内存
                .transform(new CircleCrop())//圆形裁剪
                .into((ImageView) baseViewHolder.getView(R.id.muiscfragment1_guanzhu));
        Glide.with(getContext()).load(dataBean.getVideomainimg())
//                .placeholder(R.mipmap.kotlin2)//还没有发起网络请求,一般空白或者公司logo
//                .error(R.mipmap.chentu)//发起请求失败，一般撕裂
                .diskCacheStrategy(DiskCacheStrategy.NONE)//关闭磁盘
                .skipMemoryCache(true)//关闭内存
                .transform(new CenterCrop())//居中裁剪
                .into((ImageView) baseViewHolder.getView(R.id.muiscfragment1_img));
        Glide.with(getContext()).load(dataBean.getHeadpath())
//                .placeholder(R.mipmap.kotlin2)//还没有发起网络请求,一般空白或者公司logo
//                .error(R.mipmap.chentu)//发起请求失败，一般撕裂
                .diskCacheStrategy(DiskCacheStrategy.NONE)//关闭磁盘
                .skipMemoryCache(true)//关闭内存
                .transform(new CircleCrop())//圆形裁剪
                .into((ImageView) baseViewHolder.getView(R.id.muiscfragment1_tou));
        baseViewHolder.setText(R.id.muiscfragment1_muisc,dataBean.getCaption());
        baseViewHolder.setText(R.id.muiscfragment1_name,dataBean.getAuthname());
        baseViewHolder.setText(R.id.muiscfragment1_timer,dataBean.getPublishtime());
    }
}
